<%
// 构建主页链接函数
function buildHomeLink() {
    let path = '';
    if (pageData.version) {
        path += '/' + pageData.version;
    }
    if (locals.siteData.feature?.i18n?.enable && pageData.language) {
        path += '/' + pageData.language;
    }
    return path || '/';
}

// 构建资源路径函数
function buildAssetPath(assetPath) {
    let path = '';
    if (pageData.version) {
        path += '/' + pageData.version;
    }
    return path + (assetPath.startsWith('/') ? assetPath : '/' + assetPath);
}
%>
<div class="flex items-center space-x-4 shrink-0 lg:mr-8">
    <% if (locals.siteData?.site?.logo) { %>
        <a href="<%= buildHomeLink() %>" class="flex items-center">
            <img src="<%= buildAssetPath(siteData.site.logo || '/assets/logo.svg') %>"
                 alt="<%= siteData.site.title %>"
                 class="h-10 w-auto object-contain transition-transform hover:scale-105">
        </a>
    <% } %>
    <a href="<%= buildHomeLink() %>"
       class="text-xl font-bold text-gray-900 <%= darkClasses('dark:text-white hover:text-gray-700 dark:hover:text-gray-200') %> transition-colors">
        <%= !siteData.site.hiddenTitle ? siteData.site.title : '' %>
    </a>
</div>